package com.ruoyi.system.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.system.domain.OrderAttachment;
import com.ruoyi.system.mapper.OrderAttachmentMapper;
import com.ruoyi.system.service.IOrderAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 订单附件Service业务层处理
 *
 * @author hjf
 * @date 2025-06-23
 */
@Service
public class OrderAttachmentServiceImpl implements IOrderAttachmentService {
    @Autowired
    private OrderAttachmentMapper orderAttachmentMapper;

    /**
     * 查询订单附件
     *
     * @param id 订单附件主键
     * @return 订单附件
     */
    @Override
    public OrderAttachment selectOrderAttachmentById(Long id) {
        return orderAttachmentMapper.selectOrderAttachmentById(id);
    }

    /**
     * 查询订单附件列表
     *
     * @param orderAttachment 订单附件
     * @return 订单附件
     */
    @Override
    public List<OrderAttachment> selectOrderAttachmentList(OrderAttachment orderAttachment) {
        return orderAttachmentMapper.selectOrderAttachmentList(orderAttachment);
    }

    /**
     * 新增订单附件
     *
     * @param orderAttachment 订单附件
     * @return 结果
     */
    @Override
    public int insertOrderAttachment(OrderAttachment orderAttachment) {
        orderAttachment.setCreateTime(DateUtils.getNowDate());
        return orderAttachmentMapper.insertOrderAttachment(orderAttachment);
    }

    /**
     * 修改订单附件
     *
     * @param orderAttachment 订单附件
     * @return 结果
     */
    @Override
    public int updateOrderAttachment(OrderAttachment orderAttachment) {
        return orderAttachmentMapper.updateOrderAttachment(orderAttachment);
    }

    /**
     * 批量删除订单附件
     *
     * @param ids 需要删除的订单附件主键
     * @return 结果
     */
    @Override
    public int deleteOrderAttachmentByIds(Long[] ids) {
        return orderAttachmentMapper.deleteOrderAttachmentByIds(ids);
    }

    /**
     * 删除订单附件信息
     *
     * @param id 订单附件主键
     * @return 结果
     */
    @Override
    public int deleteOrderAttachmentById(Long id) {
        return orderAttachmentMapper.deleteOrderAttachmentById(id);
    }
}
